package jp.ne.hatena.d.digitalsoul.warikan.pages

import java.text._

import org.apache.wicket.markup.html._
import org.apache.wicket.markup.html.basic._
import org.apache.wicket.markup.html.form._
import org.apache.wicket.markup.html.list._
import org.apache.wicket.model._

import jp.ne.hatena.d.digitalsoul.warikan.actions._
import jp.ne.hatena.d.digitalsoul.warikan.pages.forms._
import jp.ne.hatena.d.digitalsoul.warikan.pages.items._

class PayingPage(val partyId:String) extends WebPage {
	
	val action = new PayingAction
	
	val mainFormModel = action.createMainForm(partyId)
	
	// form:main
	val main = new Form("main", new CompoundPropertyModel(mainFormModel))
	add(main)
	
	// text:fee
	main.add(new TextField("fee"))
	
	// label:partyName
	main.add(new Label("partyName"))
	
	// label:schedule
	main.add(new Label("schedule"))
	
	// label:location
	main.add(new Label("location"))
	
	// button:cancelButton
	val cancelButton = new Button("cancelButton") {
		override def onSubmit = {
			setResponsePage(new TopPage)
		}
	}
	main.add(cancelButton)
	
	// button:commitButton
	val commitButton = new Button("commitButton") {
		override def onSubmit = {
			action.pay(partyId, mainFormModel.fee)
			setResponsePage(new TopPage)
		}
	}
	main.add(commitButton)
	
}